package com.chis.jxc;

import com.chis.jmdatatimer.comm.TxMgmtModule;
import com.chis.jxc.bean.BactStmBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Description 查询hbase电子监管码库存的数量是否和mysql库存数量一致
 * @Company zwx
 * @author wlj
 * @version 2019年09月05日
 */
public class BalanceElecCode {
    public static void main(String[] args) throws Exception {
        String zone = args[0];
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring.xml"});
        context.start();
        TxMgmtModule txMgmtModule = (TxMgmtModule) context.getBean("TxMgmtModule");
        List<BactStmBean> list = txMgmtModule.findKcByZoneElec(zone);
        List<BactStmBean> tmplist = new ArrayList<>();
        int count = 0 ;
        for(BactStmBean t : list){
            tmplist.add(t);
            count++;
            if(count > 10){
                txMgmtModule.findHbaseKcCode(tmplist);
                tmplist = new ArrayList<>();
                count = 0;
            }
        }
        if(count > 0){
            txMgmtModule.findHbaseKcCode(tmplist);
        }

    }
}
